package org.sgtools.gwt.delegate;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Service;

/**
 * @author Semyon Goryachkin
 *
 */
@Service
public class GWTServiceHelperImpl implements GWTServiceHelper, GWTServiceHelperPrivate {

	protected transient ThreadLocal<HttpServletRequest> perThreadRequest;
	protected transient ThreadLocal<HttpServletResponse> perThreadResponse;

	public void setServletData(HttpServletRequest request,
			HttpServletResponse response) {
		perThreadRequest.set(request);
		perThreadResponse.set(response);
	}

	public HttpServletRequest getServletRequest() {
		return perThreadRequest.get();
	}

	public HttpServletResponse getServletResponse() {
		return perThreadResponse.get();
	}

}
